import {eventBusRegister, eventBusGetter} from './utils/eventbus';
import { EVENT_BUS_KEY } from './common/constants';
import {routerRegister} from './utils/router';
import {initRouter} from './common/service/router-service';
import {wxCheckSession} from './common/service/login-service';

App({
    onLaunch (options) {
        console.log('=====App====onLaunch============', JSON.stringify(options));
        wxCheckSession(options);
        setTimeout(initRouter, 0);
    },
    onShow (options) {
        console.log('=====App====onShow============', JSON.stringify(options));
        if (options.scene && options.scene === 1089) {
            // 重新进入小程序，通知播放器刷新状态
            setTimeout(() => {
                eventBusGetter().$emit(EVENT_BUS_KEY.PLAY_UPDATE_STATUS, {});
            }, 0);
        }
    },
    globalData: {
        eventbus: eventBusRegister,
        router: routerRegister
    }
});
